This invention relates to a simulation device for a programmable controller (hereinafter referred to as PLC).
As one of general PLC functions, a PLC is comprised of a memory for recording the occurrences of errors caused by hardware or in communication. The conditions of presence and absence of the occurrence of an error are shown by a bit in most situations, “0” indicating no occurrence of an error and “1” indicating the presence of an error.
A program created by the user for a PLC to carry out (called the user program) is usually adapted to detect the occurrence of such errors in the PLC and to describe processes corresponding to them (referred to as the error processes). If these error processes are not being described, the system may not stop correctly after it is operated or may fail to detect the occurrence of an error in an unlikely situation where an error has occurred in the PLC and there may be a serious effect on the system.
FIG. 28 shows an example of a user program for detecting the occurrence of an error in an ordinary PLC. AR402.12 (basic IP error), AR402.08 (inner board error), AR402.07 (CPU high-performance unit error) and AR402.06 (high-performance 10 unit error) are addresses in the memory for recording the occurrence of errors. When a flag corresponding to such an address is ON, it is detected as a hardware error in a CPU unit capable of continued operation and an error process is carried out.
The memory for recording such occurrence of errors is usually made as a read-only memory in order to prevent the user program from being erroneously written over. In such a situation, it is necessary to artificially generate an error in order to ascertain that the error process is functioning correctly.
The most primitive way of artificially generating an error is to physically create a condition for generating an actual error. In such a case, a unit may be removed or a communication cable may be pulled out for the purpose of attempting to artificially generate an error. Since there are errors that would not occur unless there is a hardware error, however, it is difficult to artificially generate errors of all kinds.
Another method is to carry out a debugging process by imbedding a special command for artificially generating an error (or an error generating command) and causing an error artificially as this error generating command is executed. FIG. 29 shows an example of user program for artificially generating an error. A program including a special command for artificially generating an error (the FAL command in the example of FIG. 29) is created and used for debugging. This method, however, is cumbersome to carry out because a program for generating an error must be created. Moreover, this error generating command must be eliminated at the time of carrying out the real program, and an unexpected error may result if it is neglected to do so.
The simulation function for carrying out the debugging of the PLC on a personal computer has been known but since the same operation characteristics as on a real device are being realized and the memory for recording the aforementioned error generation is in the read-only condition, it cannot be done to realize the error condition by simulation.
Another problem with the debugging of errors of a PLC relates to missed descriptions of error processes. According to a manual, flags for showing various kinds of errors and the conditions of the PLC are in the memory for recording occurrences of errors but since there are many kinds of data, it is difficult to understand which flags in a system should be handled in what way. Especially since the number of flags to be handled as errors is increasing as the product type or the version is changed, missed descriptions of error processes tend to occur, causing a big problem at the time of the system operation. In the past, attempts were being made to simplify the manuals as much as possible but this has not been a dependable way to prevent missed error descriptions.
As shown, for example, in Japanese Patent Publication Tokkai 2004-258926, simulation devices for programs of a programmable controller for inspecting a program without connecting a PLC and an external apparatus have been known.